﻿using DayWalker.Core;
using DayWalker.Helpers;
using DayWalker.Settings;
using DayWalker;
using Styx.WoWInternals.WoWObjects;
using Styx;
using Styx.CommonBot;
using Styx.TreeSharp;

namespace DayWalker.Specialisation
{
    internal class NoSpecialisation 
    {

        #region RotationBase Overrides
     
        public static LocalPlayer Me { get { return StyxWoW.Me; } }
        #endregion

        internal static Composite Rotation
        {
            get
            {
                  return new PrioritySelector(
                    Racials.UseRacials(),
                    Common.HandleHealthstones(),
                    SummonBestPet(),
                      Helper.MovementMoveToLoS(ret => Daywalker.Me.CurrentTarget),
                   Helper.MovementMoveStop(ret => Daywalker.Me.CurrentTarget, DayWalkerSettings.Instance.DistanceRange),

                  Helper.CreateFaceTargetBehavior(),
                    Spell.Cast("Corruption", on => Daywalker.Me.CurrentTarget, ret => !Daywalker.Me.CurrentTarget.HasAura("Corruption")),
                    Spell.Cast("Drain Life", ret => Daywalker.Me.HealthPercent < 50, "HP Low"),
                    Spell.Cast("Drain Life", ret => Daywalker.Me.HealthPercent < 80 && Targeting.GetAggroOnMeWithin(Daywalker.Me.Location, 50) >= 2),
                    Spell.Cast("Shadow Bolt")
                    );
            }
        }

        private static Composite SummonBestPet()
        {
            return new PrioritySelector(
                Spell.PreventDoubleCast("Summon Imp", 6, ret => !Daywalker.Me.GotAlivePet && Daywalker.Me.Level <= 7),
                Spell.PreventDoubleCast("Summon Voidwalker", 6, ret => !Daywalker.Me.GotAlivePet && Daywalker.Me.Level >= 8),
                Spell.PreventDoubleCast("Summon Voidwalker", 6, ret => Daywalker.Me.GotAlivePet && Daywalker.Me.Pet.CreatureFamilyInfo.Id != 16)
                );
        }


        
        
    }

}
